"""
@name : 5-3.多进程-共享数据-Queue
@author : wenyao
@projectname: sanchuanglianxi
"""
#默认先进先出
from multiprocessing import Process, Queue
import time

def func(i,q):
    if not q.empty():
        print(i,"--->get value ",q.get()) #get从队列取出来
    time.sleep(2)

if __name__ == "__main__":
    p_lst = []
    q = Queue()
    for i in range(6):
        #put 放进队列
        q.put(10-i)
        p = Process(target=func, args=(i,q))
        p.start()